<!doctype html>
<html lang="en" class="orange-theme">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover, user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="Maxartkiller">

    <title>{$book.name}</title>

    <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
    <script type="text/javascript" src="/static/layui/layui.js"></script>

    <!-- iconfont CSS -->
    <link rel="stylesheet" href="/static/mobile/vendor/iconfont/iconfont.css">

    <!-- Roboto fonts CSS -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">

    <!-- Bootstrap core CSS -->
    <link href="/static/mobile/vendor/bootstrap-4.3.1/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="/static/mobile/css/style.css" rel="stylesheet">
</head>

<body>
<div class="wrapper">
    <div class="header">
        <div class="row no-gutters">
            <div class="col-auto">
                <a href="/mobile/index/index" class="btn btn-link text-dark"><i class="iconfont icon-back"></i></a>
            </div>
            <div class="col text-left header-title">{$book.name}</div>
            <div class="col-auto">
<!--                <a class="btn btn-link text-dark">-->
<!--                    <i class="iconfont icon-search"></i>-->
<!--                </a>-->
            </div>
        </div>
    </div>
    <div class="container bg-white">
        <div class="book">
            <div class="media mt-3">
                <img src="{$book.cover}" class="align-self-center mr-3 w-30" alt="...">
                <div class="media-body">
                    <h6 class="mt-0"><b>{$book.name}</b></h6>
                    <p class="mb-0"><small>{$book.author} 著</small></p>
                    <p class="mb-0"><small> {$book.tuijian} 总推荐 | {$book.book_pv} 次点击</small></p>
                    <p class="text-secondary mb-0"><small>{$book.words}字 | {if $book.complete eq 1}完本{else/}连载{/if}</small></p>
                    <p class="text-secondary mb-0"><small>最新更新至 {$newChapter.name} &nbsp;&nbsp; {$newChapter.update}</small></p>
                </div>
            </div>
            <div class="d-flex justify-content-end mt-2 pb-2 text-center border-bottom">
                <a href="/mobile/chapter/read/book_id/{$book.id}" class="btn btn-sm btn-outline-orange">点击阅读</a>
                <a href="/mobile/book/chapterList/book_id/{$book.id}" class="btn btn-sm btn-outline-success ml-2">目录</a>
            </div>
            <section id="bookSummary" class="book-summary enabled" role="option">
                <aria>书籍摘要：</aria>
                <textarea hidden="">　　{$book.descr}</textarea>
                <content>{$book.descr | mb_substr = 0,200}</content>
                <i id="showArticle" class="iconfont icon-arrowdown book-summary-more"></i>
            </section>
            <div class="d-flex justify-content-around pt-2 border-top">
                <div class="text-center">
                    <small class="text-secondary"><span id="tuinum">{$book.tuijian}</span>次 | 1次/人</small>
                    <div>
                        <button type="button" class="btn btn-sm btn-outline-success" onclick="button_outline()" id="tui">我要推荐</button>
                    </div>
                </div>
                <div class="text-center">
                    <small class="text-secondary"><span id="dasang">{$book.dasang}</span>次 | 5金币/次</small>
                    <div>
                        <button type="button" class="btn btn-sm btn-outline-danger" onclick="button_dasang()">去打赏</button>
                    </div>
                </div>
            </div>
            <div class="card mt-2 border-top border-left-0 border-right-0">
                <div class="card-body pl-0 pr-0 pb-2">
                    <h6 class="subtitle">关于作者:<a href="javascript:;" class="text-secondary pl-2"><b>{$book.author}</b></a></h6>
                    {volist name="author_books" id="author_book"}
                        <a class="d-flex justify-content-start align-items-center pb-2">
                            <a href="/mobile/book/bookInfo/id/{$author_book.id}">
                            <img src="{$author_book.cover}" alt="" class="book-icon border-radius-50">
                           <small class="card-text ml-2 text-secondary">{$author_book.name}</small>
                            </a>
                        </a>
                    {/volist}
                </div>
            </div>
            <div class="list-content mb-0">
                <h6 class="subtitle">同类好书<a href="all-products.html" class="float-right small text-secondary">更多</a></h6>
                <div class="d-flex justify-content-between flex-wrap">
                    {volist name="cate_books" id="cate_book"}
                        <a href="/mobile/book/bookInfo/id/{$cate_book.id}" class="w-30">
                        <div class="card shadow-sm border-0 mb-4">
                            <img class="w-100" src="{$cate_book.cover}" alt="...">
                            <div class="card-body">
                                <h6 class="text-overflow-elli">{$cate_book.name}</h6>
                                <p class="text-secondary small mb-2">{$cate_book.author}</p>
                            </div>
                        </div>
                    </a>
                    {/volist}
                </div>
            </div>
            <div class="list-content last">
                <h6 class="subtitle">站点推荐<a href="all-products.html" class="float-right small text-secondary">更多</a></h6>
                <div class="d-flex justify-content-between flex-wrap">
                    {volist name="site_recommend" id="site"}
                    <a href="/mobile/book/bookInfo/id/{$site.id}" class="w-30">
                        <div class="card shadow-sm border-0 mb-4">
                            {if !empty($site.cover)}
                            <img class="w-100" src="{$site.cover}" alt="...">
                            {else/}{/if}
                            <div class="card-body">
                                <h6 class="text-overflow-elli">{$site.name}</h6>
                                <p class="text-secondary small mb-2">{$site.author}</p>
                            </div>
                        </div>
                    </a>
                   {/volist}
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" name="book_id" value="{$book.id}">
<!-- jquery, popper and bootstrap js -->
<script src="/static/mobile/js/jquery-3.3.1.min.js"></script>
<script src="/static/mobile/js/popper.min.js"></script>
<script src="/static/mobile/vendor/bootstrap-4.3.1/js/bootstrap.min.js"></script>


<!-- template custom js -->
<script src="/static/mobile/js/main.js"></script>

<!-- page level script -->
<script>
    $(document).ready(function() {
        $('#bookSummary').click(function() {
            if (typeof($(this).attr("open")) != "undefined") {
                $(this).removeAttr("open style");
            } else {
                $('#bookSummary').attr({
                    'open': true,
                    'style': 'height: auto'
                })
            }

        })
    });
</script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script>
    layui.use('layer', function(){
        var layer = layui.layer;
    });
    function button_outline(){
        var book_id = $('input[name="book_id"]').val();
        $.post('/mobile/book/tuijian',{book_id:book_id},function(data){
            if(data.state != 200){
                layer.open({
                    title: '辰星中文网提示:'
                    ,content:data.msg
                });
            }else{
                $("#tui").html('已推荐');
                $("#tuinum").html(data.num);
                layer.msg('推荐投票成功', {icon: 1});
            }
        })
    }
    function button_dasang(){
        var book_id = $('input[name="book_id"]').val();
        $.post('/mobile/book/dasang',{book_id:book_id},function(data){
            /*console.log(data);*/
            if(data.state != 200){
                layer.open({
                    title: '辰星中文网提示:'
                    ,content:data.msg
                });
            }else{
                $("#dasang").html(data.num);
                layer.msg('推荐投票成功', {icon: 1});
            }
        })
    }
</script>

</body>

</html>
